// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//


#include <pollux/functions/registerer.h>
#include <pollux/functions/prestosql/array_functions.h>

namespace kumo::pollux::functions {
    namespace {
        template<typename T>
        inline void registerArrayNGramsFunctions(const std::string &prefix) {
            register_function<ArrayNGramsFunction, Array<Array<T> >, Array<T>, int32_t>(
                {prefix + "ngrams"});
        }
    } // namespace
    void registerArrayNGramsFunctions(const std::string &prefix) {
        registerArrayNGramsFunctions<int8_t>(prefix);
        registerArrayNGramsFunctions<int16_t>(prefix);
        registerArrayNGramsFunctions<int32_t>(prefix);
        registerArrayNGramsFunctions<int64_t>(prefix);
        registerArrayNGramsFunctions<int128_t>(prefix);
        registerArrayNGramsFunctions<float>(prefix);
        registerArrayNGramsFunctions<double>(prefix);
        registerArrayNGramsFunctions<bool>(prefix);
        registerArrayNGramsFunctions<Timestamp>(prefix);
        registerArrayNGramsFunctions<Date>(prefix);
        registerArrayNGramsFunctions<Varbinary>(prefix);
        registerArrayNGramsFunctions<Generic<T1> >(prefix);
        register_function<
            ArrayNGramsFunctionString,
            Array<Array<Varchar> >,
            Array<Varchar>,
            int32_t>({prefix + "ngrams"});
    }
} // namespace kumo::pollux::functions
